<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Yy</title>
</head>

<body>
    <script>
        // 1、100以内所有奇数
        var num = 0;
        while (num < 100) {
            if (num % 2 === 1) {
                console.log(num)
            }
            num++
        }
        for (var i = 0; i < 100; i++) {
            if (i % 2 === 1) {
                console.log(i)
            }
        }
        // 2、100以内（包括100）所有正整数加和
        var i = 0,
            sum = 0;
        while (i <= 100) {
            sum += i;
            i++;
        }
        console.log(sum)
        var res = 0;
        for (var i = 0; i <= 100; i++) {
            res = res + i;
        }
        console.log(res);
    </script>
</body>

</html>